<template>
  <div>
    <component
      :is="dict[key]"
    >
    </component>
  </div>
</template>

<script>
  import { ref, reactive, defineAsyncComponent } from 'vue'

</script>

<script setup>

  // 要加载的组件的key
  const key = ref('')
  // 使用动态组件加载异步组件，
  const dict = reactive({
    none: ''
  })

  const loadComp = () => {
    dict['aa'] = defineAsyncComponent(() => import('../../src/components/testCode.vue'))
    key.value = 'aa'
  }

  setTimeout(() => {
    loadComp()
  }, 2000)

</script>